<template>
	<view class="nav">
		<view class="nav_box" v-if="userType == 'coach'">
			<view class="item" v-for="item in coachNavList" :key="item.id" @click="coachOnNav(item.id)">
				<view class="icon">
					<img :src="item.img" alt="">
				</view>
				<view class="name">{{ item.name }}</view>
			</view>
		</view>
		<view class="nav_box nav_box_student" v-if="userType == 'trainee'">
			<view class="item" v-for="item in traineeNavList" :key="item.id" @click="traineeOnNav(item.id)">
				<view class="icon">
					<img :src="item.img" alt="">
				</view>
				<view class="name">{{ item.name }}</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				coachNavList: [
					{
						id: 1,
						name: '学员管理',
						img: '../../static/images/xygl.png'
					},
					{
						id: 2,
						name: '车辆管理',
						img: '../../static/images/clgl.png'
					},
					{
						id: 3,
						name: '课时管理',
						img: '../../static/images/ksgl.png'
					},
					{
						id: 4,
						name: '预约管理',
						img: '../../static/images/yygl.png'
					},
					{
						id: 5,
						name: '课程列表',
						img: '../../static/images/kclb.png'
					},
					// {
					// 	id: 6,
					// 	name: '个人中心',
					// 	img: '../../static/images/grzx.png'
					// }
				],
				traineeNavList: [
					{
						id: 1,
						name: '教练查看',
						img: '../../static/images/xygl.png'
					},
					{
						id: 2,
						name: '车辆查看',
						img: '../../static/images/clgl.png'
					},
					{
						id: 3,
						name: '课时查看',
						img: '../../static/images/ksgl.png'
					},
					// {
					// 	id: 4,
					// 	name: '预约报名',
					// 	img: '../../static/images/yygl.png'
					// },
					{
						id: 5,
						name: '模拟练习',
						img: '../../static/images/mnlx.png'
					},
					{
						id: 6,
						name: '课程列表',
						img: '../../static/images/kclb.png'
					}
				],
				userType: uni.getStorageSync('userType')
			}
		},
		methods: {
			coachOnNav(id){
				if(id == 1){
					uni.navigateTo({
						url: '/pages/student/student'
					});
				} else if(id == 2){
					uni.navigateTo({
						url: '/pages/car/car'
					});
				} else if(id == 3){
					uni.navigateTo({
						url: '/pages/classHour/classHour'
					});
				} else if(id == 4){
					uni.navigateTo({
						url: '/pages/subscribe/subscribe'
					});
				} else if(id == 5){
					uni.navigateTo({
						url: '/pages/courseList/courseList'
					});
				}
			},
			traineeOnNav(id){
				if(id == 1){
					uni.navigateTo({
						url: '/pages/studentAccount/coachList/coachList'
					});
				} else if(id == 2){
					uni.navigateTo({
						url: '/pages/studentAccount/carList/carList'
					});
				} else if(id == 3){
					uni.navigateTo({
						url: '/pages/studentAccount/classHour/classHour'
					});
				} 
				// else if(id == 4){
				// 	uni.navigateTo({
				// 		url: '/pages/studentAccount/signUp/signUp'
				// 	});
				// } 
				else if(id == 5){
					uni.navigateTo({
						url: '/pages/studentAccount/exam/exam'
					});
				} else if(id == 6){
					uni.navigateTo({
						url: '/pages/studentAccount/course/course'
					});
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
.nav {
	padding: 32rpx;
	
	.nav_box {
		width: 100%;
		display: flex;
		// justify-content: space-between;
		// flex-wrap: wrap;
		.item {
			width: 33.33%;
			// border-bottom: 1px solid #eee;
			// border-right: 1px solid #eee;
			box-sizing: border-box;   //设置box-sizing
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;
			margin-bottom: 26rpx;
			.icon {
				width: 100rpx;
				height: 100rpx;
				margin-bottom: 10rpx;
				img {
					width: 100%;
					height: 100%;
				}
			}
			.name {
				font-size: $uni-font-size-small;
			}
		}
	}	
	.nav_box_student {
		// justify-content: space-between;
		// flex-wrap: wrap;
	}
}
</style>
